﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>菜单</title>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        //页面启动函数.
        var adminer = GetQueryString("Adminer"); //管理员.
        var sid = GetQueryString("SID"); //管理员SID.
        var workID = GetQueryString("WorkID"); //管理员SID.
        var userNo = GetQueryString("UserNo"); //管理员SID.
        var flowNo = GetQueryString("FK_Flow");
        $(function () {

            var webUser = new WebUser();

            var icon = "<h5>当前用户</h5>";

            var icon = "<center><b>当前用户</b><br>";
            icon += "<img src='../../../DataUser/UserIcon/" + webUser.No + ".png' onerror=\"this.src='../../../DataUser/UserIcon/Default.png'\" />";
            icon += "</center>";
            icon += "帐号:" + webUser.No;
            icon += "<br>用户:" + webUser.Name;
            // icon += "<br>部门编号:" + webUser.FK_Dept;
            icon += "<br>部门:" + webUser.FK_DeptName;

            $("#userInfo").html(icon);

            var urlEnd = "&FK_Flow=" + flowNo + "&WorkID=" + workID + "&UserNo=" + userNo + "&Adminer=" + adminer + "&SID=" + sid;

            var html = "<ul>";
            html += "<li><a href='SelectOneUser.html?1=2" + urlEnd + "' target=right >切换用户</a></li>";
            html += "<li><a href='DBInfo.html?1=2" + urlEnd + "' target=right >数据库信息</a></li>";
            html += "<li><a href='../../WFRpt.htm?1=2" + urlEnd + "' target=right >轨迹图</a></li>";
            html += "<li><a href='javascript:Restart();' >重新启动 </a></li>";
            html += "<li><a href='javascript:LetAdminerLogin();' >安全退出 </a></li>";
            html += "</ul>";

            $("#Info").html(html);

        });

        //重新启动.
        function Restart() {

            if (window.confirm('您确认要使用[' + userNo + ']创建一个新的流程吗？') == false)
                return;
            // 使用最初用户登录
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_TestingContainer");
            handler.AddPara("FK_Emp", userNo);
            handler.AddPara("WorkID", workID);

            handler.AddPara("Adminer", adminer);
            handler.AddPara("SID", sid);

            var webUser = new WebUser();
            $("#userInfo").html(webUser.No + "," + webUser.Name);
            var data = handler.DoMethodReturnString("SelectOneUser_ChangUser");
            // 进入流程页面
            var url = "Default.html?RunModel=1&FK_Flow=" + flowNo + "&Adminer=" + webUser.No + "&SID=" + webUser.SID + "&UserNo=" + userNo;
            window.parent.location.href = url;

        }

        // 选择接收人.
        function SelectOneUser() {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_TestingContainer");
            handler.AddUrlData();
            var workid = handler.DoMethodReturnString("Default_Init");

            var url = "SelectOneUser.html?1=2" + urlEnd;
            WinOpenFull(url, "right");
            //window.location.href = url;
        }
        //如果关闭的时候，就让admin登录.
        function LetAdminerLogin() {

            if (window.confirm('您确定要退出到管理员[]吗？') == false)
                return;


            window.parent.LetAdminerLogin();
            window.parent.window.close();

            ////访问后台，获得一个工作ID.
            //var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_TestingContainer");
            //handler.AddUrlData();
            //var data = handler.DoMethodReturnString("Default_LetAdminerLogin");

            //if (data.indexOf('err@') == 0) {
            //    alert(data);
            //    return;
            //}

            return;
        }
    </script>
</head>
<body>

    <div id="userInfo"></div>

    <hr />
    <div id="Info"></div>


</body>
</html>